<div class="title">
    <h2>分类列表</h2>
    <hr/>
</div>

<ul>
    <?
    //设置需要搜索的表格的前缀后缀
    $table_Suffix = $sys_term_table;
    $table = $table_Prefix . $table_Suffix;
    //设置需要搜索的表格的前缀后缀


    //设置需要搜索的表格的排序项和升降项
    $sidebar_sort_by = "listorder";
    $sidebar_sort_order = "desc";
    //设置需要搜索的表格的排序项和升降项
    ?>




    <?php

    $query = mysql_query("SELECT COUNT(nid) FROM $table where interm = 'root' and belong ='$sys_belong' and publish ='1' ");
    $sum = mysql_result($query, 0);


    $result = mysql_query("select * from $table where interm='root' and belong ='$sys_belong' and publish ='1' ORDER BY $sidebar_sort_by $sidebar_sort_order, nid desc");

    while ($row = mysql_fetch_array($result)) {
        $sidebar_term0_nid[] = $row['nid'];
        $sidebar_term0_name[] = $row['name'];
        $sidebar_term0_url[] = $row['url'];
        $sidebar_term0_icon[] = $row['icon'];

    }
    mysql_close($con);


    ?>







    <?php
    for ($i = 0; $i < $sum; $i++) {
    ?>

    <li>
        <a href="<?php echo $sidebar_term0_url[$i] ?>.html" title="<? echo $sidebar_term0_name[$i] ?>">


            <span ><? echo $sidebar_term0_name[$i] ?></span>



        </a>
        <?php
        $query2 = mysql_query("SELECT COUNT(nid) FROM $table where term1 = $sidebar_term0_nid[$i] && interm = 'term1'");
        $term1sum = mysql_result($query2, 0);
        $result1 = mysql_query("select * from $table where term1 = $sidebar_term0_nid[$i] && interm = 'term1' ORDER BY $sidebar_sort_by $sidebar_sort_order, nid desc");
        while ($row = mysql_fetch_array($result1)) {
            {
                $term1_nid[$i][] = $row['nid'];
                $term1_name[$i][] = $row['name'];
                $term1_url[$i][] = $row['url'];
            }
        };
        ?>
        <? if($term1sum > 0){ ?>
        <div class="term_two_list">
            <ul>
                <?php
                for ($ii = 0; $ii < $term1sum; $ii++) {
                    ?>
                    <li><a href="<? echo $term1_url[$i][$ii] ?>.html" title="<? echo $term1_name[$i][$ii] ?>"><? echo $term1_name[$i][$ii] ?></a></li>
                <?php
                }
                ?>
            </ul>
        </div>
        <div class="term_two_arrow"></div>
        <? } ?>
    </li>

    <?php
    }
    ?>
</ul>

